< previous page page_455 next page >

Page 455
z0475-01.gif
Figure 13.32
Different ways to rotate a point into the Z axis.
Example program RotOrder performs these three sets of rotations and displays the results in pictures much like those in Figure 13.32. You can use the left, right, up, and down arrow keys to change the viewing directions in the three upper pictures.
The UP Vector
The three projections at the bottom of Figure 13.32 are identical except they have been rotated by different amounts around the Z axis. In addition to a center of projection and a focus point, you must decide at what angle to rotate objects around the Z axis to completely specify the projection. One way to do that is to indicate an UP vector as shown in Figure 13.33. After rotating the center of projection into the Z axis, you can rotate around the Z axis until the UP vector lies in the Y-Z plane. Then the steps for projection become:
1. Translate the focus to the origin.
2. Rotate around the Y axis to place the center of projection in the Y-Z plane.
3. Rotate around the X axis until the center of projection lies on the Z axis.
4. Rotate around the Z axis until the UP vector lies in the Y-Z plane.
5. Project (parallel or perspective) along the Z axis onto the X-Y plane.
These steps are illustrated in Figure 13.34. Here the viewing direction is drawn as a bold line between the focus point and the center of projection. The UP vector is drawn as an arrow starting at the focus point.
Example program Up follows these steps one at a time to produce pictures like those in Figure 13.34. This program draws the viewing direction in green and the UP vector in red.

 
< previous page page_455 next page >